package com.example.demo.teste;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zhangjianjian
 * @Create 2025/4/9 10:11
 */
@RestController
public class CalcController {

    @Autowired
    private  Calculator calculator;


    @RequestMapping("/test")
    public String result(@RequestParam("value")String value) {
        try {
            return Double.toString(calculator.process(value));
        } catch (Exception e) {
            return e.getMessage();
        }
    }
}
